package com.g8.pethospitallearnbackend.controller;

import com.g8.pethospitallearnbackend.entity.*;
import com.g8.pethospitallearnbackend.interceptors.AuthRequird;
import com.g8.pethospitallearnbackend.service.HosStrucService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.parameters.P;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Stack;

@Slf4j
@RestController
public class HosStrucController {
    @Autowired
    HosStrucService hosStrucService;

    @GetMapping("/department")
    public List<Department> getAllDepart(){
        return hosStrucService.getAllDepart();
    }

    @GetMapping("/staff")
    public List<Staff> getAllStaff(){
        return hosStrucService.getAllStaff();
    }

    @GetMapping("/medicine")
    public List<Medicine> getAllMedicine(){
        return hosStrucService.getAllMedicine();
    }

    @GetMapping("/lab")
    public List<Lab> getAllLab(){
        return hosStrucService.getAllLab();
    }

    //暂时没用到
    @RequestMapping("/lab/{labIdOrName}")
    public Lab getLabByIdOrName(@PathVariable String labIdOrName){
        return hosStrucService.getLabByIdOrName(labIdOrName);
    }

    @GetMapping("/vaccine")
    public List<Vaccine> getAllVaccine(){
        return hosStrucService.getAllVaccine();
    }

    @GetMapping("/hospitalization")
    public List<Hospitalization> getAllHosp(){
        return hosStrucService.getAllHosp();
    }

    @GetMapping("/charge")
    public List<Charge> getAllCharge(){
        return  hosStrucService.getAllCharge();
    }

    @AuthRequird
    @PostMapping("/department")
    public Department addDepart(@RequestBody Department department){
        return hosStrucService.addDepart(department);
    }

    @AuthRequird
    @PutMapping("/department")
    public Department updateDepart(@RequestBody Department department){
        return hosStrucService.updateDepart(department);
    }

    @AuthRequird
    @PostMapping("/staff")
    public Staff addStaff(@RequestBody Staff staff){
        return  hosStrucService.addStaff(staff);
    }





    @AuthRequird
    @PutMapping("/staff")
    public Staff modifyAStaff(@RequestBody Staff staff){
        return hosStrucService.modifyAStaff(staff);
    }

    @AuthRequird
    @PostMapping("/medicine")
    public Medicine addAMedicine(@RequestBody Medicine medicine){
        return hosStrucService.addMedicine(medicine);
    }

    @AuthRequird
    @PutMapping("/medicine")
    public Medicine modifyAMedicine(@RequestBody Medicine medicine){
        return hosStrucService.modifyAMedicine(medicine);
    }

    @AuthRequird
    @PostMapping("/lab")
    public Lab addLab(@RequestBody Lab lab){
        return hosStrucService.addLab(lab);
    }


    @AuthRequird
    @PutMapping("/charge")
    public Charge modifyACharge(@RequestBody Charge charge) {
        return hosStrucService.modifyACharge(charge);
    }

    @AuthRequird
    @DeleteMapping("/department/{departId}")
    public String deleteADepart(@PathVariable String departId) {
        return hosStrucService.deleteADepart(departId);
    }

    @AuthRequird
    @DeleteMapping("/staff/{staffId}")
    public String deleteAStaff(@PathVariable String staffId) {
        return hosStrucService.deleteAStaff(staffId);
    }

    @AuthRequird
    @DeleteMapping("/medicine/{medicineId}")
    public String deleteAMedicine(@PathVariable String medicineId) {
        return hosStrucService.deleteAMedicine(medicineId);
    }

    @AuthRequird
    @DeleteMapping("/lab/{labId}")
    public String deleteALab(@PathVariable String labId) {
        return hosStrucService.deleteALab(labId);
    }

    @AuthRequird
    @DeleteMapping("/vaccine/{vaccineId}")
    public String deleteAVaccine(@PathVariable String vaccineId) {
        return hosStrucService.deleteAVaccine(vaccineId);
    }

    @AuthRequird
    @DeleteMapping("/hospitalization/{hosId}")
    public String deleteAHospitalization(@PathVariable String hosId) {
        return hosStrucService.deleteAHos(hosId);
    }

    @AuthRequird
    @DeleteMapping("/charge/{chargeId}")
    public String deleteACharge(@PathVariable String chargeId) {
        return hosStrucService.deleteACharge(chargeId);
    }

    @GetMapping("/typelab/{typeName}")
    public List<Lab> getAllLabsOfAType(@PathVariable String typeName) {
        return hosStrucService.getAllLabsOfAType(typeName);
    }

    @GetMapping("/labtype")
    public List<String> getAllLabTypes() {
        return hosStrucService.getAllLabTypes();
    }

    @AuthRequird
    @PutMapping("/lab")
    public Lab modifyALab(@RequestBody Lab lab){
        return hosStrucService.modifyALab(lab);
    }

    @AuthRequird
    @PostMapping("/vaccine")
    public Vaccine addVaccine(@RequestBody Vaccine vaccine){
        return hosStrucService.addVaccine(vaccine);
    }

    @AuthRequird
    @PutMapping("/vaccine")
    public Vaccine modifyAVaccine(@RequestBody Vaccine vaccine){
        return hosStrucService.modifyAVaccine(vaccine);
    }

    @AuthRequird
    @PostMapping("/hospitalization")
    public Hospitalization addHospitalization(@RequestBody Hospitalization hospitalization){
        return hosStrucService.addHospitalization(hospitalization);
    }

    @AuthRequird
    @PutMapping("/hospitalization")
    public Hospitalization modifyAHospitalization(@RequestBody Hospitalization hospitalization){
        return hosStrucService.modifyAHospitalization(hospitalization);
    }

    @AuthRequird
    @PostMapping("/charge")
    public Charge addCharge(@RequestBody Charge charge){
        return hosStrucService.addCharge(charge);
    }


    @GetMapping("medicine/{medicineIdOrName}")
    public Medicine getAMedicine(@PathVariable String medicineIdOrName){
        return hosStrucService.getMedicineByIdOrName(medicineIdOrName);
    }

    @GetMapping("/department/{departIdOrName}")
    public Department getADepartment(@PathVariable String departIdOrName){
        return hosStrucService.getDepartmentByIdOrName(departIdOrName);
    }
}
